﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.Diagnostics;

namespace 沙鹿便签.View
{
    public partial class AddTaskPage : PhoneApplicationPage
    {
       ApplicationBarIconButton savebar;
        public AddTaskPage()
        {
            InitializeComponent();
            savebar = ApplicationBar.Buttons[0] as ApplicationBarIconButton;
            savebar.IsEnabled = false;
            newTaskTextbox.Focus();
            
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            
            base.OnNavigatedTo(e);
            
        }
        private void Save_Click(object sender, EventArgs e)
        {
            App.QueryNewTask = new Model.CTask();
            App.QueryNewTask.Content = newTaskTextbox.Text;
            App.QueryNewTask.CreateTime = DateTime.Now;
            if (this.NavigationService.CanGoBack)
            {
                this.NavigationService.GoBack();
            }
        }


        private void newTaskTextbox_KeyUp_1(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (newTaskTextbox.Text.Equals("")) savebar.IsEnabled = false;
            else savebar.IsEnabled = true;
        }

      
    }
}